﻿#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
/*

		1byte = 8bit
		1KB = 1024byte
		1MB = 1024KB
		1GB = 1024MB
		1TB = 1024GB
		1PB = 1024TB
		.0


*/

/*
* 
int main()
{
	int a = 10;

	return 0;
}

*/
#if 0
int main()
{
	int a = 10;
	&a; // 取出a的地址
	printf("%p\n", &a);
	return 0;
}
#endif

#if 0
int main()
{
	int a = 10;
	int* pa = &a;//取出a的地址并存储到指针变量pa中

	return 0;
}
#endif

/*

	int a = 10;
	int* pa = &a;
	这⾥pa左边写的是 int* 
	* 是在说明pa是指针变量，
	⽽前⾯的 int 是在说明pa指向的
	是整型(int)类型的对象。

*/

#if 0
int main()
{
	char ch = 'w';
	char* pc = &ch;

	return 0;
}
#endif

#if 0
int main()
{
	int a = 100;
	int* pa = &a;
	*pa = 0;

	printf("%d\n", a);//0
	return 0;
}
#endif

/*


#include <stdio.h>
//指针变量的⼤⼩取决于地址的⼤⼩
//32位平台下地址是32个bit位（即4个字节）
//64位平台下地址是64个bit位（即8个字节）
int main()
{
	printf("%zd\n", sizeof(char*));
	printf("%zd\n", sizeof(short*));
	printf("%zd\n", sizeof(int*));
	printf("%zd\n", sizeof(double*));
	return 0;
}


*/

#if 0
int main()
{
	int n = 10;
	char* pc = (char*)&n;
	int* pi = &n;

	printf("%p\n", &n);
	printf("%p\n", pc);
	printf("%p\n", pc + 1);
	printf("%p\n", pi);
	printf("%p\n", pi + 1);
	return 0;
}
#endif


#include <stdio.h>
#if 0
int main()
{
	int m = 0;
	m = 20;//m是可以修改的
	const int n = 0;
	n = 20;//n是不能被修改的
	return 0;
}
#endif

#if 0
int main()
{
	const int n = 0;
	printf("n = %d\n", n);
	int* p = &n;
	*p = 20;
	printf("n = %d\n", n);//通过地址进行修改后
	return 0;
#endif 
